<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8" />
	<title>Document</title>
	<link type="text/css" rel="stylesheet" href="__PUBLIC__/Admin/css/style.css" />
	<script type="text/javascript" src="__PUBLIC__/Admin/js/jquery-1.8.3.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/Admin/js/menu.js"></script>
	<style type="text/css">
		#addform{
			text-align: center;
			margin: 15px auto 10px auto;
		}
		table{
			width: 100%;
			text-align: center;
			margin-left: auto;
			margin-right: auto;
		}
		table th{
			background-color: #11B6B6;
			color: white;
			font-family: "微软雅黑";
		}
		#pageinfo{
			margin: 15px auto;
			text-align: center;
		}
		#update{
			width: 400px;
			background: white;
			height: 150px;
			border: solid 3px #DDDDDD;
			position: absolute;
			top: 25%;
			left: 38%;
			display: none;
			
		}
		#update p{
			margin-top: 40px;
			margin-left: 20px;
		}
		#spanX{
			position: absolute;
			top: 2px;
			right: 3px;
		}
	</style>
</head>
<body>
	<div id="addform">
		<form action="__URL__/insert" method="post">
			<span>网站名称:</span>
			<input type="text" name="link_name"/>
			<span>网站链接:</span>
			<input type="text" name="link_url" value="http://"/>
			<input type="submit" value="添加" />
		</form>
	</div>
	
	<table cellspacing="1" cellpadding="2" id="list-table">
		<tr><th>网站名称</th><th>链接地址</th><th>编辑</th><th>删除</th></tr>
		<?php foreach($friends as $friend):?>
		<tr>
			<td><?php echo $friend['link_name'];?></td>
			<td><?php echo $friend['link_url'];?></td><td><a href="JavaScript:;" onclick="funAjax(<?php echo $friend['fri_id'];?>,'<?php echo $friend['link_name'];?>','<?php echo $friend['link_url'];?>');">编辑</a></td>
			<td><a href="__URL__/delete/fri_id/<?php echo $friend['fri_id'] ;?>">删除</a></td>
		</tr>
		<?php endforeach;?>
	</table>
	<div id="update">
		<form action="__URL__/update" method="post">
			<p><span>网站名称:</span>
				<input type="hidden" id="fri_id" name="fri_id" value="" />
				<input type="text" id="link_name" name="link_name" value="" />
				<br />
				<span>链接地址:</span>
				<input type="text" id="link_url" name="link_url" value="" />
				<input type="submit" value="修改" />
			</p>
		<span id="spanX"><a href="JavaScript:;">×</a></span>
	</form>
	</div>
	<p id="pageinfo">{$pageinfo}</p>
	<script type="text/javascript">
		function funAjax(fri_id,link_name,link_url){
			document.getElementById("update").style.display="block";
			document.getElementById("fri_id").value=fri_id;
			document.getElementById("link_url").value=link_url;
			document.getElementById("link_name").value=link_name;
		}
		var closewind=document.getElementById("spanX");
		closewind.onclick=function(){
			document.getElementById("update").style.display="none";
		}
	</script>
	
</body>
</html>